import ProForm, {InputNumber, InputSwitch, InputText, InputTextArea} from "@/common/form";
import {SecurityUser} from "@/type/SecurityUser";
import {useLocation} from "react-router-dom";


const UserUpdateComponent = () => {
    const userId: number = useLocation().state.id;

    return (
        <ProForm<SecurityUser>
            title={"用户更新"}
            backText={"用户列表"}
            update
            initialDataUrl={"/manager/admin/security_user/one/" + userId}
            updateUrl={"/manager/admin/security_user"}
        >
            <InputText<SecurityUser> name={"username"} label={"用户名"}/>
            <InputText<SecurityUser> name={"identity"} label={"用户身份"}/>
            <InputText<SecurityUser> name={"avatar"} label={"用户头像"}/>
            <InputSwitch<SecurityUser> name={"enabled"} label={"用户未禁用"}/>
            <InputSwitch<SecurityUser> name={"accountNonLocked"} label={"用户未锁定"}/>
            <InputSwitch<SecurityUser> name={"accountNonExpired"} label={"用户未过期"}/>
            <InputSwitch<SecurityUser> name={"credentialsNonExpired"} label={"密码未过期"}/>
            <InputNumber name={"order"} label={"用户排序"}/>
            <InputTextArea name={"remark"} label={"备注信息"} rows={3}/>
        </ProForm>
    );
};

export default UserUpdateComponent;